<?xml version="1.0" encoding="utf-8" ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta name="generator" content="Docutils 0.5: http://docutils.sourceforge.net/" />
<title>Actions</title>
<link rel="stylesheet" href="doc.css" type="text/css" />
</head>
<body>
<div class="document">
<div class="navigation navigation-header container">
<span class="previous">Previous: <a class="reference" href="actions_transformations_and_effects.html" title="Actions, Transformations and Effects">Actions, Transformations ...</a></span><span class="next">Next: <a class="reference" href="basic_actions.html" title="Basic actions">Basic actions</a></span><span class="breadcrumbs"><a class="reference" href="index.html" title="Programming Guide">Programming Guide</a> » <a class="reference" href="actions_transformations_and_effects.html" title="Actions, Transformations and Effects">Actions, Transformations ...</a> » Actions</span></div>
<h1 class="title">Actions</h1>

<p>Actions are like orders given to any <a class="reference apilink" href="../api/cocos.cocosnode.CocosNode-class.html " title="cocos.cocosnode.CocosNode">CocosNode</a> object.
These actions usually modify some the object's attributes like <cite>position</cite>,
<cite>rotation</cite>, <cite>scale</cite>, etc. If these attributes are modified during a period of time,
they are <a class="reference apilink" href="../api/cocos.actions.base_actions.IntervalAction-class.html " title="cocos.actions.base_actions.IntervalAction">IntervalAction</a> actions, otherwise they are <a class="reference apilink" href="../api/cocos.actions.base_actions.InstantAction-class.html " title="cocos.actions.base_actions.InstantAction">InstantAction</a> actions.</p>
<p>For example, the <a class="reference apilink" href="../api/cocos.actions.interval_actions.MoveBy-class.html " title="cocos.actions.interval_actions.MoveBy">MoveBy</a> actions modifies the <cite>position</cite> attribute during a period
of time, hence, it is an <cite>IntervalAction</cite>.</p>
<p>Example:</p>
<pre class="py-doctest">
<span class="py-comment"># Move a sprite 50 pixels to the right, and 100 pixel to the top in 2 seconds.</span>
sprite.do( MoveBy( (50,100), duration=2 ) )</pre>
<p>The <cite>IntervalAction</cite> actions have some interesting properties:</p>
<blockquote>
<ul>
<li><dl class="first docutils">
<dt>The can be accelerated using the time-altered actions</dt>
<dd><ul class="first last simple">
<li><a class="reference apilink" href="../api/cocos.actions.interval_actions.Accelerate-class.html " title="cocos.actions.interval_actions.Accelerate">Accelerate</a></li>
<li><a class="reference apilink" href="../api/cocos.actions.interval_actions.AccelDeccel-class.html " title="cocos.actions.interval_actions.AccelDeccel">AccelDeccel</a></li>
<li><a class="reference apilink" href="../api/cocos.actions.interval_actions.Speed-class.html " title="cocos.actions.interval_actions.Speed">Speed</a></li>
</ul>
</dd>
</dl>
</li>
<li><p class="first">All the relative actions (the ones ending in 'By') and some
absolute actions (the ones ending in 'To')  have a <cite>Reverse</cite> action
that executes the action in the opposite direction.</p>
</li>
</ul>
</blockquote>
<div class="navigation navigation-footer container">
<span class="previous">Previous: <a class="reference" href="actions_transformations_and_effects.html" title="Actions, Transformations and Effects">Actions, Transformations ...</a></span><span class="next">Next: <a class="reference" href="basic_actions.html" title="Basic actions">Basic actions</a></span><span class="breadcrumbs"><a class="reference" href="index.html" title="Programming Guide">Programming Guide</a> » <a class="reference" href="actions_transformations_and_effects.html" title="Actions, Transformations and Effects">Actions, Transformations ...</a> » Actions</span></div>
</div>
</body>
</html>
